const path = require('path');
const webpack = require('webpack');

const designWidth = 750;
const p2rLoader = {
  loader: 'px2rem-loader',
  options: {
    remUnit: designWidth / 10
  }
};

module.exports = {
  entry: {
    main: './home/main.js'
  },
  output: {
    filename: 'home.js',
    path: path.join(__dirname, 'src/js')
  },
  module: {
    rules: [{
        test: /\.less$/,
        use: ['style-loader', 'css-loader', 'postcss-loader', p2rLoader, 'less-loader']
      },
      {
        test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: 'img/[name].[ext]'
        }
      },
      {
        test: /\.js$/,
        use: ['babel-loader'],
        exclude: /node_modules/
      }
    ]
  },
  devServer: {
    port: '80',
    host: '0.0.0.0',
    disableHostCheck: true
  }
}